package cn.iocoder.yudao.module.handguard.controller.app.userbasetable9;

import cn.iocoder.yudao.module.handguard.controller.app.userbasetable14.vo.UserBaseTable14RespVO;
import cn.iocoder.yudao.module.handguard.convert.userbasetable14.UserBaseTable14Convert;
import cn.iocoder.yudao.module.handguard.dal.dataobject.userbasetable14.UserBaseTable14DO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;

import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;

import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;

import cn.iocoder.yudao.module.handguard.controller.app.userbasetable9.vo.*;
import cn.iocoder.yudao.module.handguard.dal.dataobject.userbasetable9.UserBaseTable9DO;
import cn.iocoder.yudao.module.handguard.convert.userbasetable9.UserBaseTable9Convert;
import cn.iocoder.yudao.module.handguard.service.userbasetable9.UserBaseTable9Service;

@Tag(name = "小程序 - 商业商住楼写字楼二次抵押")
@RestController
@RequestMapping("/hutai/user-base-table9")
@Validated
public class UserBaseTable9Controller {

    @Resource
    private UserBaseTable9Service userBaseTable9Service;

    @PostMapping("/create")
    @Operation(summary = "创建商业商住楼写字楼二次抵押")
    public CommonResult<Long> createUserBaseTable9(@Valid @RequestBody UserBaseTable9CreateReqVO createReqVO) {
        return success(userBaseTable9Service.createUserBaseTable9(createReqVO));
    }

    @PutMapping("/update")
    @Operation(summary = "更新商业商住楼写字楼二次抵押")
    public CommonResult<Boolean> updateUserBaseTable9(@Valid @RequestBody UserBaseTable9UpdateReqVO updateReqVO) {
        userBaseTable9Service.updateUserBaseTable9(updateReqVO);
        return success(true);
    }


    @GetMapping("/get")
    @Operation(summary = "获得商业商住楼写字楼二次抵押")
    public CommonResult<UserBaseTable9RespVO> getUserBaseTable9(@RequestParam("id") Long id) {
        UserBaseTable9DO userBaseTable9 = userBaseTable9Service.getUserBaseTable9(id);
        return success(UserBaseTable9Convert.INSTANCE.convert(userBaseTable9));
    }

    @GetMapping("/list")
    @Operation(summary = "获得商业商住楼写字楼二次抵押列表")
    public CommonResult<List<UserBaseTable9RespVO>> getUserBaseTable9List(Long ui) {
        List<UserBaseTable9DO> list = userBaseTable9Service.getUserBaseTable9List(ui);
        return success(UserBaseTable9Convert.INSTANCE.convertList(list));
    }



}
